Skip to content

fix(cli): respect --json flag on lint error paths#125

Closed
miguel-heygen wants to merge 1 commit into03-29-fix_cli_suppress_ansi_escape_codes_in_non-tty_progress_outputfrom
03-29-fix_cli_respect_--json_flag_on_lint_error_paths
Closed

fix(cli): respect --json flag on lint error paths#125
miguel-heygen wants to merge 1 commit into03-29-fix_cli_suppress_ansi_escape_codes_in_non-tty_progress_outputfrom
03-29-fix_cli_respect_--json_flag_on_lint_error_paths

Conversation

@miguel-heygen
Copy link
Copy Markdown
Collaborator

@miguel-heygen miguel-heygen commented Mar 29, 2026

PR Stack

# PR Status
1 #122 — fix: info width/height swap ← base
2 #123 — fix: include all 9 templates in build
3 #124 — fix: suppress ANSI in non-TTY
4 #125 — fix: lint --json error paths
5 #126 — fix: separate info/warning counts
6 #127 — fix: lint severity display
7 #128 — fix: render output path error
8 #129 — fix: zero-duration error message ← top

Summary

  • When lint --json encountered an error (e.g., invalid directory), it output plain text instead of JSON, breaking agent JSON parsing pipelines
  • resolveProject() threw before the JSON output logic was reached
  • Now wraps the entire run() body in try-catch that emits JSON errors when --json is set

Reproducer

npx hyperframes lint --json /nonexistent/path
# Was: "Not a directory: /nonexistent/path" (plain text, breaks JSON.parse)
# Now: {"ok": false, "error": "Not a directory: /nonexistent/path", "_meta": {...}}

Stack

4/8 — Depends on #124

🤖 Generated with Claude Code

When lint encountered an error (e.g., invalid directory), it output
plain text even with --json, breaking JSON parsing pipelines for
agents. Now wraps the entire lint command in try-catch that emits
JSON errors when --json is set.

Reproducer:
  npx hyperframes lint --json /nonexistent/path
  # Was: plain text "Not a directory: /nonexistent/path"
  # Now: {"ok": false, "error": "Not a directory: /nonexistent/path", ...}
@miguel-heygen
Copy link
Copy Markdown
Collaborator Author

Consolidated into fix/lint-improvements.

@miguel-heygen miguel-heygen deleted the 03-29-fix_cli_respect_--json_flag_on_lint_error_paths branch April 6, 2026 23:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant